<template>
    <div>
        <p>num{{num}}</p>
        <p>doublue1 {{double1}}</p>
        <input type="text" v-model="double2">
    </div>
</template>
<script>
export default {
    data() {
        return {
            num:20
        }
    },
    computed: {
        double1(){
            return this.num*2
        },
        // 如果是双向数据绑定则一定要有get和set
        double2:{
            get(){
                return this.num*2
            },
            set(val){
                this.num=val/2
            }
        }
    },
}
</script>
<style>
    
</style>